package com.jiazhong.Service.Impl;

import com.jiazhong.Dao.GoodsDao;
import com.jiazhong.Dao.Impl.GoodsDaoImpl;
import com.jiazhong.Model.Goods;
import com.jiazhong.Service.GoodsService;

import javax.servlet.http.HttpServlet;
import java.util.List;

public class GoodsServiceImpl extends HttpServlet implements GoodsService {
    GoodsDao goodsDao=new GoodsDaoImpl();

    /**
     * 查询所有商品
     * @return
     */
    @Override
    public List<Goods> queryGoods() {
        return goodsDao.queryGoods();
    }

    /**
     * 根据商品Id删除商品
     * @param goods_id
     */
    @Override
    public void delGoodsById(int goods_id) {
        goodsDao.delGoodsById(goods_id);
    }

    /**
     * 根据goods_id查询单个商品信息
     * @param goods_id
     * @return
     */
    @Override
    public Goods queryGoodsById(int goods_id) {
        return goodsDao.queryGoodsById(goods_id);
    }

    /**
     * 修改商品数据
     * @param goods
     */
    @Override
    public void updateGoods(Goods goods) {
        goodsDao.updateGoods(goods);
    }
}
